home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_vol_falloutfloor.cog < prev    next >
Text File  |  1999-11-15  |  4KB  |  209 lines

  1. # Jones 3D Cog Script
  2. #
  3. # Vol_FalloutFloor.cog
  4. #
  5. # collapses upto 14 floor with a cool algorithm
  6. #
  7. # [MR]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11. symbols
  12.  
  13.     message        entered
  14.     message        pulse
  15.  
  16.     thing    player    local
  17.     
  18.     #cog        debriscog
  19.  
  20.  
  21.     thing    tTile0
  22.     thing    tTile1
  23.     thing    tTile2
  24.     thing    tTile3
  25.     thing    tTile4
  26.     thing    tTile5
  27.     thing    tTile6
  28.     thing    tTile7
  29.     thing    tTile8
  30.     thing    tTile9
  31.     thing    tTile10
  32.     thing    tTile11
  33.     thing    tTile12
  34.     thing    tTile13
  35.     
  36.     thing    fragment1    local
  37.     thing    fragment2    local
  38.     
  39.     thing    shakeTile    local
  40.     
  41.     surface    entrance
  42.     surface    exit
  43.  
  44.     int    falling=0    local
  45.     int    numtiles=14    local
  46.     int    i            local
  47.     int    alldead=0    local
  48.     int    curTile        local
  49.     int    dir            local
  50.     
  51.     int    iTileLife0=100    local
  52.     int    iTileLife1=100    local
  53.     int    iTileLife2=100    local
  54.     int    iTileLife3=100    local
  55.     int    iTileLife4=100    local
  56.     int    iTileLife5=100    local
  57.     int    iTileLife6=100    local
  58.     int    iTileLife7=100    local
  59.     int    iTileLife8=100    local
  60.     int    iTileLife9=100    local
  61.     int    iTileLife10=100    local
  62.     int    iTileLife11=100    local
  63.     int    iTileLife12=100    local
  64.     int    iTileLife13=100    local
  65.     
  66.     int    iMin            local
  67.     int    iMax            local
  68.     #int    debstart=0        local
  69.  
  70.     template    debris=stoneshrapa    local
  71.  
  72.     flex        CheckTileStatus        local
  73.  
  74. end
  75. # ================================================
  76. code
  77.  
  78. entered:
  79.     
  80.     #DebugPrint("entered");
  81.     #if (debstart == 0)
  82.         #{
  83.         #debstart = 1;
  84.         #SendMessage(debriscog, user0);
  85.         #}
  86.  
  87.     for (curTile=0; curTile<numtiles; curTile=curTile+1)
  88.     {
  89.         if ( GetSenderRef() == tTile0[curTile] )
  90.         {
  91.             
  92.             #DebugFlex(curTile,"tile injured");
  93.             
  94.             iTileLife0[curTile] = iTileLife0[curTile] - 30;
  95.             call CheckTileStatus;
  96.             return;
  97.         }
  98.     }
  99.  
  100.     
  101.     If (GetSenderRef() == entrance)
  102.     {
  103.         
  104.         #DebugPrint("pulse set");
  105.         SetPulse(.10);
  106.     }
  107.  
  108.        
  109. return;
  110.  
  111.  
  112. # ================================================
  113. pulse:
  114.     If (falling == 1) return;
  115.  
  116.     alldead = 1;
  117.     for (curTile=0; curTile<numtiles; curTile=curTile+1)
  118.     {
  119.         If ( iTileLife0[curTile] < 200 )
  120.         {
  121.             alldead = 0;
  122.         }
  123.         if ( iTileLife0[curTile] < 100 )
  124.         {
  125.             iTileLife0[curTile] = iTileLife0[curTile] - 10;
  126.             call CheckTileStatus;
  127.         }
  128.     }
  129.     If (alldead == 1) SetPulse(0); 
  130.     #SendMessage(debriscog, user1);
  131.     return;
  132.  
  133.  
  134. # ================================================
  135. CheckTileStatus:
  136.     if ( iTileLife0[curTile] <= 0 )
  137.     {
  138.         falling = 1;
  139.  
  140.         // Mark as 'dead'
  141.         iTileLife0[curTile] = 200;
  142.  
  143.         // Disturb neighbors
  144.         if ( curTile < numTiles/2 )
  145.         {
  146.             iMin = 0;
  147.             iMax = numTiles/2;
  148.             i    = 1;
  149.         }
  150.         else
  151.         {
  152.             iMin = numTiles/2;
  153.             iMax = numTiles;
  154.             i    = -1;
  155.         }
  156.  
  157.         if ( CurTile - 1 > iMin )
  158.         {
  159.             if ( iTileLife0[CurTile-1] < 200 )
  160.             {
  161.                 iTileLife0[CurTile-1] = iTileLife0[CurTile-1] - 80;
  162.             }
  163.         }
  164.         if ( CurTile + 1 < iMax )
  165.         {
  166.             if ( iTileLife0[CurTile+1] < 200 )
  167.             {
  168.                 iTileLife0[CurTile+1] = iTileLife0[CurTile+1] - 80;
  169.             }
  170.         }
  171.         if ( iTileLife0[CurTile + (i * numTiles/2)] < 200 )
  172.         {
  173.             if ( iTileLife0[CurTile + (i * numTiles/2)] < 200 )
  174.             {
  175.                 iTileLife0[CurTile + (i * numTiles/2)] = iTileLife0[CurTile + (i * numTiles/2)] - 80;
  176.             }
  177.         }
  178.  
  179.  
  180.         // Do falling effects here
  181.         
  182.         #DebugPrint("destroy code hit");
  183.         
  184.         shakeTile = curTile;
  185.         for (i=0; i <= 8; i = i + 1) 
  186.         {
  187.             dir=RandBetween(0, 1);
  188.             SetPOVShake('0.0 0.0 0.00', '0.0 0.0 0.003', 80.0, 0.80);
  189.             Rotate(tTile0[shakeTile], 6, dir, .025);
  190.             Sleep(0.025);
  191.             Rotate(tTile0[shakeTile], -6, dir, .025);
  192.             Sleep(0.025);
  193.         }
  194.         
  195.         fragment1 = CreateThing(debris, tTile0[shakeTile]);                                 
  196.         fragment2 = CreateThing(debris, tTile0[shakeTile]);
  197.         #SetThingMass(fragment1, 1);
  198.         #SetThingMass(fragment2, 1);
  199.         SetThingVel(fragment1, VectorSet(RandBetween(0, 4)/10, RandBetween(0, 2)/10, -.5));
  200.         SetThingVel(fragment2, VectorSet(RandBetween(0, 4)/10, RandBetween(0, 2)/10, -.5));
  201.         SetThingRotVel(fragment1, VectorScale(VectorAdd(RandVec(), '0.0 0.0 0.0'), 100.0));
  202.         SetThingRotVel(fragment2, VectorScale(VectorAdd(RandVec(), '0.0 0.0 0.0'), 100.0));
  203.     
  204.         DestroyThing(tTile0[shakeTile]);
  205.         falling =0;
  206.     }
  207.     return;
  208.  
  209.     end